package cn.iocoder.yudao.module.product.dal.mysql.packaging;


import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.product.dal.dataobject.packaging.PackagingDO;
import cn.iocoder.yudao.module.product.dal.dataobject.packaging.PackagingSkuDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.product.controller.admin.packaging.vo.*;

import java.util.List;

/**
 * 商品包装物 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface PackagingMapper extends BaseMapperX<PackagingDO> {

    default PageResult<PackagingDO> selectPage(PackagingPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<PackagingDO>()
                .eqIfPresent(PackagingDO::getSkuId, reqVO.getSkuId())
                .likeIfPresent(PackagingDO::getSpuName, reqVO.getSpuName())
                .eqIfPresent(PackagingDO::getCylinderId, reqVO.getCylinderId())
                .eqIfPresent(PackagingDO::getStatus, reqVO.getStatus())
                .eqIfPresent(PackagingDO::getIsRent, reqVO.getIsRent())
                .eqIfPresent(PackagingDO::getRentCycle, reqVO.getRentCycle())
                .eqIfPresent(PackagingDO::getRentReferencePr, reqVO.getRentReferencePr())
                .eqIfPresent(PackagingDO::getRentUpperPr, reqVO.getRentUpperPr())
                .eqIfPresent(PackagingDO::getRentLowerPr, reqVO.getRentLowerPr())
                .eqIfPresent(PackagingDO::getDepositReferencePr, reqVO.getDepositReferencePr())
                .eqIfPresent(PackagingDO::getDepositUpperPr, reqVO.getDepositUpperPr())
                .eqIfPresent(PackagingDO::getDepositLowerPr, reqVO.getDepositLowerPr())
                .betweenIfPresent(PackagingDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(PackagingDO::getUpdater, reqVO.getUpdater())
                .orderByDesc(PackagingDO::getId));
    }

    List<PackagingDO> getPackagingPage(PackagingPageReqVO pageReqVO);
}